/*
https://leetcode.cn/problems/maximum-height-of-a-triangle/description/
3200. 三角形的最大高度
*/

class Solution {
public:
    int test(int red,int blue){
        for(int i=1;i<100;i++)
        {
            if(i%2==1){
                red-=i;
                if(red<0)
                return i-1;
            }
            else
            {
                blue-=i;
                if(blue<0)
                return i-1;
            }
        }
        return 0;
    }

    int maxHeightOfTriangle(int red, int blue) {
        return max(test(red,blue),test(blue,red));
    }
};
